#!/usr/bin/env python
# -*- coding: utf-8 -*-

import MySQLdb
import time
import sys

try:

    time1=time.time()
    max=int(sys.argv[1])+1
    conn=MySQLdb.connect(host='10.10.10.200',user='vcg',passwd='vcg123',port=3306)   
    conn.select_db('virtual_chinese_genome')

    for i in range(1,max):
        cur=conn.cursor()
        query="select ref from ref_chr1 where id="+str(i)
        count=cur.execute(query)
        result=cur.fetchone()
        # print result
        conn.commit()
        cur.close()

    conn.close()

    time2=time.time()
    t=time2-time1
    print t

except MySQLdb.Error,e:
    print "Mysql Error %d: %s" % (e.args[0], e.args[1])
